#coding=utf-8
"""
===========================
Author:杭州多测师_周sir
Time:2022/9/14 10:03
website:https://duoceshi.net
===========================
"""
import requests

class Send_Requests(object):
    '''封装一个发送接口请求的工具类'''
    def __init__(self):
        '''保持会话'''
        self.session = requests.Session()
    def send(self,method,url,data=None,json=None,params=None,headers=None):
        method = method.lower()   #把接口的请求方法全部改为小写
        if method == "get":
            response = self.session.get(url,params)
        elif method == "post":
            response = self.session.post(url,data,headers)
        elif method == "post_json":
            response = self.session.post(url,json,headers)
        elif method =="delete":
            response = self.session.delete(url)
        return response


























































